<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <script>
        // 训练3
        let compare01 = function (number01, number02) {
            if (number01 === number02) {
                return `${number01}=${number02}`
            }
            return number01 > number02 ? `${number01}>${number02}` : `${number01}<${number02}`
        }
        document.write(`${compare01(10, 10)}<br>`)
        // 训练4
        let compare02 = function (number01, number02, number03) {
            if (number01 <= number02 && number01 <= number03) {
                return `${number01}是最小的`
            } else if (number02 < number01 && number02 < number03) {
                return `${number02}是最小的`
            } else {
                return `${number03}是最小的`
            }
        }
        document.write(`${compare02(10, 9, 33)}<br>`)

        // 训练5
        let promotion01 = function (money01) {
            return money01
        }

        let promotion02 = function (money02) {
            return promotion01(199) + money02
        }

        let promotion03 = function (money03) {
            return promotion02(165) + money03
        }
        let promotion = promotion03(156);
        if (promotion >= 500) {
            document.write(`可以享受优惠<br>`)
        } else {
            document.write(`不可以享受优惠<br>`)
        }

        // 训练6
        let enroll01 = function (grade01) {
            return grade01
        }
        let enroll02 = function (grade02) {
            return enroll01(108) + grade02
        }
        let enroll03 = function (grade03) {
            return enroll02(115) + grade03
        }
        let enroll04 = function (grade04) {
            return enroll03(126) + grade04
        }
        let enroll = enroll04(237);
        if (enroll >= 500) {
            document.write(`到达本科分数线<br>`)
        } else {
            document.write(`未到达本科分数线<br>`)
        }

        // 训练7
        let logIn = function (username, password) {
            return username == 'mr' && password == 'mrsoft' ? '登陆成功<br>' : '登录失败<br>'
        }
        document.write(logIn('mr', 'mrsoft'))

        // 训练8
        let divisible = function (number01) {
            // if (number01 % 3 == 0 && number01 % 5 == 0) {
            //     return `${number01}能被3和5同时整除`
            // } else {
            //     return `${number01}不能被3和5同时整除`
            // }
            let arr = []
            for (let i = 999; i >= 0; i--) {
                if (i % 3 != 0 || i % 5 != 0) {
                    continue;
                }
                arr.push(i)
            }
            return arr
        }
        let arrNumber = divisible();
        let row = parseInt((divisible().length / 7) + 1)
        document.write('<table>');
        let index = 0;
        for (let i = 1; i <= row; i++) {
            document.write('<tr>');
            for (let j = 1; j <= 7; j++) {
                if (i == row && j > 4) {
                    break
                }
                document.write(`<td>${arrNumber[index]}</td>`);
                index++;
            }
            document.write('</tr>');
        }
    </script>
</body>

</html>